package com.xinchuang.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xinchuang.domain.entity.TestNoticeMainTabale;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xinchuang.domain.vo.NoteDetailVo;
import com.xinchuang.domain.vo.NoteListItemVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * @author GHKJ002
 * @description 针对表【test_notice_main_tabale】的数据库操作Mapper
 * @createDate 2023-07-03 10:54:14
 * @Entity com.xinchuang.domain.TestNoticeMainTabale
 */
@Mapper
public interface TestNoticeMainTabaleMapper extends BaseMapper<TestNoticeMainTabale> {

    IPage<NoteListItemVo> getNoteList(Page page,
                                      @Param("starttime") String starttime,
                                      @Param("endtime") String endtime,
                                      @Param("moldId") String moldId,
                                      @Param("moldName") String moldName,
                                      @Param("versionId") String versionId,
                                      @Param("tongman") Integer tongman,
                                      @Param("username") String username,
                                      @Param("list") List<String> list,
                                      @Param("tongName") List<String> tongName,
                                      @Param("projectName") String projectName);

    Integer getNoteTotal(@Param("starttime") String starttime, @Param("endtime") String endtime, @Param("moldId") String moldId, @Param("versionId") String versionId, @Param("offset") String offset, @Param("pageSize") String pageSize);

    NoteDetailVo noteDetail(@Param("noteId") String noteId);

    @Select(value = {
            "SELECT * FROM test_notice_main_tabale WHERE parent_plan_sub_id IN (",
            "SELECT mst.plan_id FROM test_model_param mp JOIN test_model_sub_table mst ON mp.mold_id = mst.mold_id",
            "WHERE mp.customer_name = #{customerName} AND mst.create_time BETWEEN #{start} AND #{end})"
    })
    List<TestNoticeMainTabale> getCustomerMains(@Param("customerName")String customerName ,@Param("start") String start, @Param("end") String end);



}




